<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/taglib.jsp"%>
<%@ taglib prefix="ec" uri="/WEB-INF/taglib/extremecomponents.tld" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
     <link href="<%=basePath%>index/Themes/com/style.css" rel="stylesheet" type="text/css" />
    <script src="<%=basePath%>index/Scripts/Script.js" language="javascript" type="text/javascript"></script>
  	<TITLE>添加用户组</TITLE>
	<SCRIPT type="text/javascript">
	
	function check(){
	 var fm=document.forms[0];
	  if(fm.groupname.value==""){
	    alert("请填写角色名称！");
	    fm.groupname.focus();
	    return false;
	    }
    if(fm.groupdes.value==""){
       alert("请填写角色描述！");
       fm.groupdes.focus();
       return false;
       }

   var opObj = document.getElementsByName('selectId');
     if (opObj.length) {
	   for (i=0;i<opObj.length;i++) {
		  if (opObj[i].checked) {			
			   return true;		   
		  }
	   }
   } else {
	   if (opObj.checked) {
           return true;		
	   }
   }
   alert("请为此分组至少选择一个权限！");
	 return false
}

  
function changSelSta(itemValue){
   var i;
   var opObj = document.getElementsByName('selectId');
 //  var desObj = document.forms[0].selurlDes;
   for (i=0;i<opObj.length;i++) {
      if (opObj[i].value == itemValue) {
        opObj[i].checked = true;
        break;
      }
   }
}
	</SCRIPT>
</head>
<body  class="idt_body" scroll="yes"> 
 <form method="post" action="group.htm?action=addGroup&flag=add" target="_self" onSubmit="return check();">
  <table cellpadding="0" cellspacing="0" width="100%" height="100%" id="Table8">
        <tr>
            <td  valign="top" height="100%">
                            <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" id="Table11">
                                <tr  id="ldTR">
                                    <td  valign="top">
                                        <!------------------ 标题栏 ------------------>
                                        <!--- 标题 ---->
                                        <table class="idt_tle_mg" cellspacing="0" cellpadding="0" width="100%">
                                            <tr>
                                                <td class="idt_tle_i">
                                                    <img id="imgForm6" src="<%=basePath%>index/Themes/com/idt_tle_o.gif"></td>
                                                <td class="idt_tle_f1">
                                                   添加用户组</td>
                                            </tr>
                                        </table>
      <div id="tdForm1">
             <table class="idt_fim_mg" cellspacing="1" cellpadding="0" width="100%" id="">
                 <tr id="tab1">
                     <td>
	   <fieldset align="center">
	                <legend class="com_legend">基本信息 </legend>
	                <div id="Tr1" class="content">
	                    &nbsp;</div>
		<table  border="0" cellpadding="0" cellspacing="1" width="100%" class="com_fieldset_tab">
		  <tr>
		    <td  class="fim_l">角色名称</td>
		    <td class="fim_r"><input  class="com_textbox" name="groupname" type="text" maxlength="20"><font color="red">*</font></td>
		  </tr>
		  <tr>
		    <td>角色描述</td>
		    <td class="fim_r"><input name="groupdes"  class="com_textbox" type="text" maxlength="128"><font color="red">*</font></td>
		  </tr>
		</table>
     </fieldset>
   </td>
  </tr>
  <tr id="tab2">
      <td>
   <fieldset align="center">
             <legend class="com_legend">配置权限 </legend>
             <div id="Tr1" class="content">
                 &nbsp;</div>
<table  border="0" cellpadding="0" cellspacing="1" width="100%" class="com_fieldset_tab">
  <tr>	
 <td  class="fim_l"> 
 <c:forEach items="${authList}" var="authority" begin="0" step="2"> 
 <input type="checkbox" name="selectId" value="${authority.authid}">${authority.authdes}<br></c:forEach>
 </td>
 <td>
  <c:forEach items="${authList}" var="authority" begin="1" step="2">
 <input type="checkbox"  name="selectId" value="${authority.authid}">${authority.authdes}<br></c:forEach>
 </td>
</tr>
</table>
</fieldset>
    </td>
    </tr>
  </table>
  <table cellspacing="0" cellpadding="0" width="100%" class="idt_bottom_mg" border="0">
        <tr>
            <td align="right">
                <input  class="com_btn2" id="Button1" name="save" type="submit" value="保存">&nbsp;&nbsp;&nbsp;&nbsp;
               <input type="button" value="取消" name="B4" class="com_btn2" id="Button2" onclick="javascript:window.close();">
            </td>
        </tr>
    </table>                               

<br>
      </table>
            </td>
        </tr>
    </table></form>
</body>
</html>